﻿using System;
using System.Collections.Generic;
using System.Data;

namespace BLL.SUBSYSTEM
{
   /// <summary>
	/// 业务逻辑类SUBSYS_STATISTICALPARAMETER 的摘要说明。
	/// </summary>
	public class SUBSYS_STATISTICALPARAMETER
	{
		private readonly OracleDAL.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER dal=new OracleDAL.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER();
		public SUBSYS_STATISTICALPARAMETER()
		{}
		#region  成员方法
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string SUBSYSTEMID,string PARAMETERNAME)
		{
			return dal.Exists(SUBSYSTEMID,PARAMETERNAME);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void Add(Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER model)
		{
			dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public void Update(Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER model)
		{
			dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public void Delete(string SUBSYSTEMID,string PARAMETERNAME)
		{
			
			dal.Delete(SUBSYSTEMID,PARAMETERNAME);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER GetModel(string SUBSYSTEMID,string PARAMETERNAME)
		{
			
			return dal.GetModel(SUBSYSTEMID,PARAMETERNAME);
		}

        ///// <summary>
        ///// 得到一个对象实体，从缓存中。
        ///// </summary>
        //public Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER GetModelByCache(string SUBSYSTEMID,string PARAMETERNAME)
        //{
			
        //    string CacheKey = "SUBSYS_STATISTICALPARAMETERModel-" + SUBSYSTEMID+PARAMETERNAME;
        //    object objModel = LTP.Common.DataCache.GetCache(CacheKey);
        //    if (objModel == null)
        //    {
        //        try
        //        {
        //            objModel = dal.GetModel(SUBSYSTEMID,PARAMETERNAME);
        //            if (objModel != null)
        //            {
        //                int ModelCache = LTP.Common.ConfigHelper.GetConfigInt("ModelCache");
        //                LTP.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
        //            }
        //        }
        //        catch{}
        //    }
        //    return (Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER)objModel;
        //}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER> DataTableToList(DataTable dt)
		{
			List<Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER> modelList = new List<Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new Model.SUBSYSTEM.SUBSYS_STATISTICALPARAMETER();
					model.SUBSYSTEMID=dt.Rows[n]["SUBSYSTEMID"].ToString();
					model.PARAMETERNAME=dt.Rows[n]["PARAMETERNAME"].ToString();
					model.TABLENAME=dt.Rows[n]["TABLENAME"].ToString();
					model.TABLENAMEFIELD=dt.Rows[n]["TABLENAMEFIELD"].ToString();
					model.METHOD=dt.Rows[n]["METHOD"].ToString();
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  成员方法
	}
}

